package com.example.liwushuo.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class Utils {

	public static boolean isFrist(Context context) {

		SharedPreferences preferences = context.getSharedPreferences("isfrist",
				context.MODE_PRIVATE);
		boolean isfrist = preferences.getBoolean("isfrist", true);
		if (isfrist) {
			Editor edit = preferences.edit();
			edit.putBoolean("isfrist", false);
			edit.commit();
		}

		return isfrist;
	}

	// 获取参数 保存到共享参数中
	public static void SaveParams(Context context, String name, String Values) {

		SharedPreferences preferences = context.getSharedPreferences("params",
				context.MODE_PRIVATE);

		String values = preferences.getString(name, null);
		if (values == null) {
			Editor edit = preferences.edit();
			edit.putString(name, Values);
			edit.commit();
		}
	}

	// 从共享参数中获取参数

	public static String getParams(Context context, String name) {
		SharedPreferences preferences = context.getSharedPreferences(
				"params", context.MODE_PRIVATE);
		String Values = preferences.getString(name, null);
		return Values;
	}
}
